<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        * {
            margin: 0;
            padding: 0;
            border: 0;
            box-sizing: border-box;
        }
        #container {
            display: inline-block; /* 使容器尺寸由内容决定 */
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            line-height: 0;     /* 消除底部间隙 */
        }
    </style>
</head>

<body>
    <audio></audio>
    <div id='container'>
        <video autoplay muted playsinline style="object-fit: contain; width: auto; height: auto; max-width: 100vw; max-height: 100vh;"></video>
    </div>
    <script type='text/javascript' src="../js/parsec.js"></script>
    <script type='text/javascript' src='../js/main.js'></script>
    <script>
        // 监听 container 大小变化
        const container = document.getElementById('container');
        const observer = new ResizeObserver(entries => {
            for (let entry of entries) {
                const { width, height } = entry.contentRect;
                // 向应用侧上报
                JSObj.setVideoSize(width,height)
            }
        });
        observer.observe(container);
    </script>
</body>
</html>